<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ftconv</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="ftchnls.html" title="ftchnls" />
    <link rel="next" href="ftcps.html" title="ftcps" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ftconv</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ftchnls.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="ftcps.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="ftconv"></a>
      <div class="titlepage"></div>
      <a id="IndexFtconv" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ftconv</span>
        </h2>
        <p>ftconv — 
      Low latency multichannel convolution, using a function table as impulse
	response source.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111419840"></a>
        <h2>Description</h2>
        <p>
	Low latency multichannel convolution, using a function table as impulse
	response source. The algorithm is to split the impulse response to
	partitions of length determined by the <span class="emphasis"><em>iplen</em></span> parameter, and delay and
	mix partitions so that the original, full length impulse response is
	reconstructed without gaps. The output delay (latency) is <span class="emphasis"><em>iplen</em></span> samples,
	and does not depend on the control rate, unlike in the case of other
	convolve opcodes.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111422240"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">a1[, a2[, a3[, ... a8]]] <span class="command"><strong>ftconv</strong></span> ain, ift, iplen[, iskipsamples \
      [, iirlen[, iskipinit]]]</pre>
      </div>
      <div class="refsect1">
        <a id="idp111424336"></a>
        <h2>Initialization</h2>
        <p>
	<span class="emphasis"><em>ift</em></span>
	-- source ftable number. The table is expected to contain interleaved
   multichannel audio data, with the number of channels equal to the number
   of output variables (a1, a2, etc.). An interleaved table can be created
   from a set of mono tables with <a class="link" href="GEN52.html" title="GEN52"><em class="citetitle">GEN52</em></a>.
   </p>
        <p>
	<span class="emphasis"><em>iplen</em></span>
	-- length of impulse response partitions, in sample frames; must be an
   integer power of two. Lower settings allow for shorter output delay, but
   will increase CPU usage.
   </p>
        <p>
	<span class="emphasis"><em>iskipsamples</em></span>
	(optional, defaults to zero) -- number of sample frames to skip
   at the beginning of the table.
   Useful for reverb responses that have some amount of initial delay.
   If this delay is not less than <span class="emphasis"><em>iplen</em></span> samples, then setting
   <span class="emphasis"><em>iskipsamples</em></span> to the same value as <span class="emphasis"><em>iplen</em></span>
   will eliminate any additional latency by <span class="emphasis"><em>ftconv</em></span>.
   </p>
        <p>
   	<span class="emphasis"><em>iirlen</em></span>
   	(optional) -- total length of impulse response, in sample frames.
   	The default is to use all table data (not including the guard point).
   	</p>
        <p>
	<span class="emphasis"><em>iskipinit</em></span>
	(optional, defaults to zero) -- if set to any non-zero value, skip
	initialization whenever possible without causing an error.
	</p>
      </div>
      <div class="refsect1">
        <a id="idp111433056"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ain</em></span>
      -- input signal.
      </p>
        <p>
      <span class="emphasis"><em>a1 ... a8</em></span>
      -- output signal(s).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111435520"></a>
        <h2>Example</h2>
        <p>
      Here is an example of the ftconv opcode. It uses the file <a class="ulink" href="examples/ftconv.csd" target="_top"><em class="citetitle">ftconv.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp111437376"></a>
          <p class="title">
            <strong>Example 328. Example of the ftconv opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o ftconv.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="ohdr">sr</span>      <span class="op">=</span>  48000
<span class="ohdr">ksmps</span>   <span class="op">=</span>  32
<span class="ohdr">nchnls</span>  <span class="op">=</span>  2
<span class="ohdr">0dbfs</span>   <span class="op">=</span>  1

garvb   <span class="opc">init</span> 0
gaW     <span class="opc">init</span> 0
gaX     <span class="opc">init</span> 0
gaY     <span class="opc">init</span> 0

itmp    <span class="ohdr">ftgen</span>   1, 0, 64, <span class="op">-</span>2, 2, 40, <span class="op">-</span>1, <span class="op">-</span>1, <span class="op">-</span>1, 123,           \
               1, 13.000, 0.05, 0.85, 20000.0, 0.0, 0.50, 2,   \
               1,  2.000, 0.05, 0.85, 20000.0, 0.0, 0.25, 2,   \
               1, 16.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1,  9.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1, 12.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1,  8.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2

itmp    <span class="ohdr">ftgen</span> 2, 0, 262144, <span class="op">-</span>2, 0
       <span class="opc">spat3dt</span> 2, <span class="op">-</span>0.2, 1, 0, 1, 1, 2, 0.005

itmp    <span class="ohdr">ftgen</span> 3, 0, 262144, <span class="op">-</span>52, 3, 2, 0, 4, 2, 1, 4, 2, 2, 4

       <span class="oblock">instr</span> 1

a1      <span class="opc">vco2</span> 1, 440, 10
kfrq    <span class="opc">port</span> 100, 0.008, 20000
a1      <span class="opc">butterlp</span> a1, kfrq
a2      <span class="opc">linseg</span> 0, 0.003, 1, 0.01, 0.7, 0.005, 0, 1, 0
a1      <span class="op">=</span>  a1 <span class="op">*</span> a2 <span class="op">*</span> 2
       <span class="opc">denorm</span> a1
       <span class="opc">vincr</span> garvb, a1
aw, ax, ay, az  <span class="opc">spat3di</span> a1, p4, p5, p6, 1, 1, 2
       <span class="opc">vincr</span> gaW, aw
       <span class="opc">vincr</span> gaX, ax
       <span class="opc">vincr</span> gaY, ay

       <span class="oblock">endin</span>

       <span class="oblock">instr</span> 2

       <span class="opc">denorm</span> garvb
<span class="comment">; skip as many samples as possible without truncating the IR</span>
arW, arX, arY   <span class="opc">ftconv</span> garvb, 3, 2048, 2048, (65536 <span class="op">-</span> 2048)
aW      <span class="op">=</span>  gaW <span class="op">+</span> arW
aX      <span class="op">=</span>  gaX <span class="op">+</span> arX
aY      <span class="op">=</span>  gaY <span class="op">+</span> arY
garvb   <span class="op">=</span>  0
gaW     <span class="op">=</span>  0
gaX     <span class="op">=</span>  0
gaY     <span class="op">=</span>  0

aWre, aWim      <span class="opc">hilbert</span> aW
aXre, aXim      <span class="opc">hilbert</span> aX
aYre, aYim      <span class="opc">hilbert</span> aY
aWXr    <span class="op">=</span>  0.0928<span class="op">*</span>aXre <span class="op">+</span> 0.4699<span class="op">*</span>aWre
aWXiYr  <span class="op">=</span>  0.2550<span class="op">*</span>aXim <span class="op">-</span> 0.1710<span class="op">*</span>aWim <span class="op">+</span> 0.3277<span class="op">*</span>aYre
aL      <span class="op">=</span>  aWXr <span class="op">+</span> aWXiYr
aR      <span class="op">=</span>  aWXr <span class="op">-</span> aWXiYr

       <span class="opc">outs</span> aL, aR

       <span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 0.5  0.0  2.0 -0.8
<span class="stamnt">i</span> 1 1 0.5  1.4  1.4 -0.6
<span class="stamnt">i</span> 1 2 0.5  2.0  0.0 -0.4
<span class="stamnt">i</span> 1 3 0.5  1.4 -1.4 -0.2
<span class="stamnt">i</span> 1 4 0.5  0.0 -2.0  0.0
<span class="stamnt">i</span> 1 5 0.5 -1.4 -1.4  0.2
<span class="stamnt">i</span> 1 6 0.5 -2.0  0.0  0.4
<span class="stamnt">i</span> 1 7 0.5 -1.4  1.4  0.6
<span class="stamnt">i</span> 1 8 0.5  0.0  2.0  0.8
<span class="stamnt">i</span> 2 0 10
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111441664"></a>
        <h2>See also</h2>
        <p>
      <a class="link" href="pconvolve.html" title="pconvolve"><em class="citetitle">pconvolve</em></a>,
      <a class="link" href="convolve.html" title="convolve"><em class="citetitle">convolve</em></a>,
      <a class="link" href="dconv.html" title="dconv"><em class="citetitle">dconv</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111445664"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Istvan Varga</td>
          </tr>
          <tr>
            <td>2005</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ftchnls.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="ftcps.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ftchnls </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> ftcps</td>
        </tr>
      </table>
    </div>
  </body>
</html>
